1. Field of the Invention
The present invention relates to a method for generating instructions for an object-oriented processor for the purpose of testing the processor. More particularly, the invention relates to a method for generating instructions for use with a processor implementing the Java Virtual Machine (JVM).
2. The Background Art
Random code generators typically are used to provide instructions to fully test the capability of a processor. For example, a random code generator has been implemented for use with the Reduced Instruction Set Computer (RISC) processor.
An object-oriented program is organized upon a collection of objects, each of which is an instance of a class, or set of objects sharing a common structure and a common behavior. A property is an inherent or distinctive characteristic or feature that defines a particular object. A property may be static, or fixed, or dynamic. Thus, each object has the properties of its class.
Each object may comprise two types of components, fields and methods. A field, or instance variable, contains part of the state of an object. The fields of an object, therefore, constitute the structure of an object. A method, or member function, is a function that belongs to a particular class. Each method is an operation upon an object, similar to a subroutine or procedure.
In an object-oriented program, each class is a member of a hierarchy of classes which are related to one another through inheritance relationships. Through inheritance, a class shares the structure or behavior of one or more classes. Each derived class, or subclass, inherits some or all object properties from its parent class, or superclass. Furthermore, a derived class typically "specializes" its superclass, or superclasses, by redefining the existing structure or behavior. First, the derived class may add a new property not inherited from the parent class. For example, a new field not existing within a parent class may be created within the derived class. Second, a derived class may "override" an inherited property, thereby shadowing, or hiding, the property of the parent class. Overriding occurs when a method or field within a derived class has a name identical to a method or field within a parent class, in addition to having identical types. This results in only the method or field name defined within the subclass being visible within that subclass. For example, a method "TRANSMIT(INTEGER)" defined within both a derived class and a parent class results in the method defined within only the subclass being visible within that subclass. Third, a property within a derived class may be "overloaded" by using the same property name of the parent class, the property having different types than used in the parent class, resulting in two distinct properties being visible within the derived class. A field or method may be overloaded by using the same field or method name of the parent class with a different parameter type than used in the parent class, resulting in two distinct fields or methods rather than shadowing the parent field or method. For example, a method "TRANSMIT(INTEGER, FLOAT)" defined within a derived class and a method "TRANSMIT(INTEGER, INTEGER)" defined within a parent class will result in both methods being visible within the derived class. Both fields and methods may be added, shadowed or overloaded.
Within the class hierarchy, the classes, as well as the methods and fields of each class, may have one of three levels of visibility to other classes of objects. First, a class, method or field may be public. Public status ensures access by all classes of objects. Second, a private status may be selected. A private class, method or field is visible only to the objects of that particular class, and inaccessible by other classes of objects. Third, selecting a protected status allows access to the protected class, method or field from all derived classes of that class.
A given programming language may be strongly typed, weary typed, or untyped. Typing is the enforcement of the class of an object, which prevents objects of different types from being interchanged or, allows them to be interchanged only in very restricted circumstances. Thus, when a programming language is strongly typed, type conformance is strictly enforced. It follows that type consistency must be rigidly enforced when generating instructions for such a processor.
An object oriented processor requires that instructions be valid object-oriented instructions. A need exists in the prior art for an instruction generator for testing the features of an object-oriented processor. More particularly, a need exists in the prior art for an instruction generator for use with the JVM.